{% extends "base.html" %}

{% block content %}
	<div id="search-form" class="section">
    	<h3>Admin Libraries</h3>
    	<div class="form">
    	<input type="text" id="search-text" style="width: 50%; float:left; margin-right: 1em" />
    	<label style="float:left">
		<select id="library-kind">
			<option value="">All</option>
			<option value="validated">BookBurrito</option>
			<option value="community">Community</option>
		</select>  
    	<select id="search-problem-count">
			<option value="-1">Libraries with no failures</option>
			<option value="" selected="selected">All Libraries</option>
			<option value="1">Libraries with 1 or more failures</option>
			<option value="3">Libraries with 3 or more failures</option>
    	</select>
    	&nbsp;<a id="add-library" href="#">Add Library</a>
    	</label>
    	<br clear="both" />
    	<table class="matrix" id="search-results">
    	<thead>
    	<tr><th id="search-results-title" colspan="3">Search Results<div class="pager"></div></th></tr>
    	<tr id="sorting"><th><a href="#" id="sort-title">Title</a></th><th><a href="#" id="sort-tested">Tested</a></th><th>Actions</th></tr>
    	</thead>
    	<tbody>
    	</tbody>
    	</table>

    	<pre id="debug">{{debug}}</pre>

    	</div>
    	
    </div>
    	

<div id="custom-form" class="section hidden">

<h3>Edit Library Configuration</h3>

<div class="form">

<div class="field">
<label for="custom-title">Library Title:
<span class="tip">Dislayed in the BookBurrito listing</span>
</label>
<input id="custom-title" name="title" value="DC - Library of Congress" />
</div>

<div class="field">
<label for="custom-name">Library Name:
<span class="tip">Unique name in us.tx.library_name format (or UID for Community) - <a href="#" id="set-name-from-title">Set from Title</a></span>
</label>
<input id="custom-name" name="name" value="us.dc.library_of_congress" />
</div>

<div class="field">
<label>Library Kind:
</label>
<div>
<input id="custom-kind-validated" name="kind" value="validated" type="radio" style="width: auto"/>
<label for="custom-kind-validated" class="radio">
Verified
<span class="tip">Official BookBurrito Library</span>
</label>
</div>
<div>
<input id="custom-kind-community" name="kind" value="community" type="radio" style="width: auto"/>
<label for="custom-kind-community" class="radio">
Community
<span class="tip">Unvalidated library submitted by the community</span>
</label>
</div>
</div>

<div class="field">
<label for="custom-link">Link:
<span class="tip">URL to library catalog query (must contain #{ISBN} replacement token)</span>
</label>
<input id="custom-link" name="link" value="http://www.loc.gov/search/?q=#{ISBN}&amp;fa=digitized:false"/>
</div>

<div class="field">
<label>Search Results Interpretation:</label>
</div>

<div class="field">
<input type="radio" id="custom-match_missing" name="search_results" style="width: auto" checked="checked"/>
<label for="custom-match_missing" class="radio">
Missing Text
<span class="tip">Text returned by unsuccessful catalog query contains the following text:</span>
</label>
</div>

<div class="field" id="field-missing" style="padding-left: 1.5em">
<input id="custom-missing" name="missing" value="We did not find any matches for this search." />
</div>

<div class="field">
<input type="radio" id="custom-match_isbn" name="search_results" style="width: auto"/>
<label for="custom-match_isbn" class="radio">
Match ISBN in results
<span class="tip">Text returned by successful catalog query contains the ISBN</span>
</label>
</div>

<div class="field">
<label for="custom-have">Existing Book:
<span class="tip">ISBN of a book that exists in the library catalog</span>
</label>
<input id="custom-have" name="have" value="0399155341"/>
<div class="example" />
</div>

<div class="field">
<label for="custom-dont">Missing Book:
<span class="tip">ISBN of a book that does <b>not</b> exist in the library catalog</span>
</label>
<input id="custom-dont" name="dont" value="0399155342" />
<div class="example" />
</div>

<pre class="test-results"></pre>

<div class="buttons">
<button id="custom-test">Test</button>
<button id="custom-save">Save</button>
<button id="custom-save-validate">Save and Validate</button>
<button id="custom-save-validate-next">Save, Validate, Go Next</button>
<button id="custom-cancel">Cancel</button>
</div>
</div>
</div>

{% endblock %}

{% block html_body_end %}
<script src="/assets/js/jquery.timeago.js"></script>
<script src="/assets/js/sites.js"></script>
<script src="/assets/js/pager.js"></script>
<script src="/assets/js/isbn.js"></script>
<script src="/assets/js/edit-library.js"></script>
<script src="/assets/js/admin/list.js"></script>
<script src="/assets/js/typewatch.js"></script>
{% endblock %}